package com.demo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author gxd
 * @since 2025/6/1
 */
@Getter
@AllArgsConstructor
public enum DeletedEnum {

    YES(1, "删除"),
    NO(0, "未删除");

    private final int code;
    private final String message;

    public String isTrue(int code) {
        for (DeletedEnum de: DeletedEnum.values()) {
            if (de.getCode() == code) {
                return de.getMessage();
            }
        }

        throw new RuntimeException("未通过当前code查询到合法的枚举类型code=" + code);
    }

}
